Bug 322934 – Replace menu's proxy icons with empty space hiding icons
authorMatthias Clasen <matthiasc@src.gnome.org>
Sat, 1 Nov 2008 04:32:40 +0000 (04:32 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sat, 1 Nov 2008 04:32:40 +0000 (04:32 +0000)
        * gtk/gtkmenu.c (gtk_menu_size_request): Use consistent padding
        regardless of imagees or checks being in the menu. Also add
        padding on the right edge.
        Proposal by Luca Ferretti, patch by Jon McCann

svn path=/trunk/; revision=21745

ChangeLog
gtk/gtkmenu.c

index e2ba9b3e49e7656f5d47f81d6a790bf725ae17d5..b7c292887a84a3843aefba7f806693bda10b7af9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-11-01  Matthias Clasen  <mclasen@redhat.com>
+
+       Bug 322934 – Replace menu's proxy icons with empty space hiding icons
+
+       * gtk/gtkmenu.c (gtk_menu_size_request): Use consistent padding
+       regardless of imagees or checks being in the menu. Also add
+       padding on the right edge.
+       Proposal by Luca Ferretti, patch by Jon McCann
+
 2008-11-01  Matthias Clasen  <mclasen@redhat.com>
 
        Bug 412134 – Add API to query style properties from the style
index d97b7859189c65efcb0e3ae9224f6f736ea162d9..ad439c0a7e2d6c4c9767f13e9646fe12e4a78b2f 100644 (file)
@@ -31,6 +31,8 @@
 #include "gtkaccellabel.h"
 #include "gtkaccelmap.h"
 #include "gtkbindings.h"
+#include "gtkcheckmenuitem.h"
+#include  <gobject/gvaluecollector.h>
 #include "gtkmain.h"
 #include "gtkmarshalers.h"
 #include "gtkmenu.h"
@@ -2429,10 +2431,26 @@ gtk_menu_size_request (GtkWidget      *widget,
        priv->heights[t] = MAX (priv->heights[t], part);
     }
 
+  /* if the menu doesn't include any images or check items
+   * reserve the space so that all menus are consistent */
+  if (max_toggle_size == 0)
+    {
+      guint toggle_spacing;
+      guint indicator_size;
+
+      gtk_style_get (widget->style,
+                     GTK_TYPE_CHECK_MENU_ITEM,
+                     "toggle-spacing", &toggle_spacing,
+                     "indicator-size", &indicator_size,
+                     NULL);
+
+      max_toggle_size = indicator_size + toggle_spacing;
+    }
+
   for (i = 0; i < gtk_menu_get_n_rows (menu); i++)
     requisition->height += priv->heights[i];
 
-  requisition->width += max_toggle_size + max_accel_width;
+  requisition->width += 2 * max_toggle_size + max_accel_width;
   requisition->width *= gtk_menu_get_n_columns (menu);
 
   gtk_widget_style_get (GTK_WIDGET (menu),